//
//  WGDetailCitiesTableViewController.m
//  QuickCure1
//
//  Created by Apple on 16/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "WGDetailCitiesTableViewController.h"

#import "HomeViewController.h"

static NSString *cellID = @"cell";

@interface WGDetailCitiesTableViewController ()

@end

@implementation WGDetailCitiesTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"城市选择";
    //注册cell
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellID];
}


#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    
    return self.cities.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    cell.textLabel.text = self.cities[indexPath.row];
    [cell.textLabel setTextColor:[UIColor jq_randomColor]];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    //获取当前行上的文字
    NSString *selCity = self.cities[indexPath.row];
    
    //发送通知
    [[NSNotificationCenter defaultCenter]postNotificationName:kSelectedeCityNotiCation object:selCity];

    //实现城市界面的转场动画
    [[ZWGAnimationTransition sharedAnimationTransition] addTransitionWithType:KTransisonRippleEffect duration:0.5 subType:kTransitionFromLeft layer:self.tableView.superview.layer];

    //返回到根视图
    [self.navigationController popToRootViewControllerAnimated:YES];
 
}


@end
